package adapter;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.List;

import bean.InfoSchoolBean;
import bean.InfoSchoolBean2;
import jiyun.com.yiyanmeng.R;

/**
 * Created by Rascal on 2019/11/11.
 */

public class EditInfoSchool2Adapter extends RecyclerView.Adapter {

    private List<InfoSchoolBean2> mSchooldata2s;
    private Context mContext;

    public EditInfoSchool2Adapter(List<InfoSchoolBean2> schooldata2s, Context context) {
        mSchooldata2s = schooldata2s;
        mContext = context;
    }

    @NonNull
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View inflate = LayoutInflater.from(mContext).inflate(R.layout.layout_infoitem, parent,false);

        return new ViewHolder(inflate);
    }

    @Override
    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
        ViewHolder holder1 = (ViewHolder) holder;
        holder1.mTvSchool.setText(mSchooldata2s.get(position).get_$7().getZhuan_name());
    }

    @Override
    public int getItemCount() {
        return mSchooldata2s.size();
    }

    static class ViewHolder extends RecyclerView.ViewHolder{
        View view;
        TextView mTvSchool;

        ViewHolder(View view) {
            super(view);
            this.view = view;
            this.mTvSchool = (TextView) view.findViewById(R.id.tv_school);
        }
    }
}
